******************************************************************************
	*** Figure 3 ***
******************************************************************************
	
	//Use main data
	use "${maindta}", clear

/************** DESCRIPTIVE AND COUNTRY-LEVEL RESULTS ***********************/

 *Kernel densities
	foreach q in 10 25 50 75 90  {
		rifhdreg firm_score_est [pw=wt], rif(q(`q'))
		global l`q'=_b[_cons]
		rifhdreg score_centered [pw=wt_rs], rif(q(`q'))
		global cl`q'=_b[_cons]
	}
	rifhdreg firm_score_est [pw=wt], rif(std)
	global rif_sd=_b[_cons]
	rifhdreg score_centered [pw=wt_rs], rif(std)
	global crif_sd=_b[_cons]
 
	kdensity firm_score_est [aw=wt] , name(cty_density_b, replace) xlab(,nogrid labsize(large)) ylab(,nogrid labsize(large)) note("") title("a. Overall Distribution" , size(large)) ytitle("") xtitle("")  clwidth(thick) xline($l10 $l25 $l75 $l90, lcolor(gs7%50)) xline($l50, lcolor(gs4) lwidth(thick)) text(.01 $l50 "Median", box bcolor(white) fcolor(white) lcolor(white) lwidth(vvthick)) nodraw
	kdensity score_centered [aw=wt_rs] , name(cty_density_a, replace) xlab(,nogrid labsize(large)) ylab(,nogrid labsize(large)) note("") title("b. Centered Distribution", size(large)) ytitle("") xtitle("") clwidth(thick) nodraw xline(0)
	graph combine cty_density_b cty_density_a, ycommon xsize(7.0) ysize(3.5)
	
	graph export "${outfigures}\Figure3.pdf", replace
	
	
 *Reproduces the output for Table 3: Summary Statistics across All Firms
	
 